<template>
  <a-table
    row-key="name"
    :data="data"
    :row-selection="{
      type: 'checkbox',
      showCheckedAll: true,
      onlyCurrent: false,
    }"
    v-model:selectedKeys="selectedKeys"
    :pagination="pagination"
  >
    <template #columns>
      <a-table-column :title="item.title" :data-index="item.dataIndex" v-for="item in columns"></a-table-column>
      <a-table-column title="操作">
        <template #cell="{ record }">
          <a-button size="small" type="text" @click="fnDetail(record)">详情</a-button>
          <a-button size="small" type="text">确认报名</a-button>
          <a-button size="small" type="text" @click="fnSallocation(record)">分配</a-button>
          <a-button size="small" type="text">失效</a-button>
        </template>
      </a-table-column>
    </template>
  </a-table>
</template>

<script setup lang="ts">
import { reactive, ref } from 'vue'

const selectedKeys: any = ref(['Jane Doe', '王小二'])
const pagination: { pageSize: number } = { pageSize: 5 }
const rowSelection = reactive({
  type: 'checkbox',
  showCheckedAll: true,
  onlyCurrent: false,
})
const columns: any = [
  {
    title: '姓名',
    dataIndex: 'name',
  },
  {
    title: '手机号',
    dataIndex: 'phone',
  },
  {
    title: '证型',
    dataIndex: 'licenseType',
  },
  {
    title: '录入时间',
    dataIndex: 'inputTime',
  },
  {
    title: '状态',
    dataIndex: 'status',
  },
  {
    title: '跟进时间',
    dataIndex: 'followTime',
  },
  {
    title: '来源',
    dataIndex: 'source',
  },
]
const data: any = reactive([
  {
    key: '1',
    name: 'Jane Doe',
    phone: 13121299909,
    licenseType: 'C1',
    inputTime: '2025-04-19 12:00:00',
    status: '跟进中',
    followTime: '2025-04-19 12:00:00',
    source: '微信',
  },
  {
    key: '2',
    name: '王小二',
    phone: 13121289909,
    licenseType: 'C1',
    inputTime: '2025-04-19 12:00:00',
    status: '跟进中',
    followTime: '2025-04-19 12:00:00',
    source: '微信',
  },
  {
    key: '3',
    name: '张三',
    phone: 13121299989,
    licenseType: 'C2',
    inputTime: '2025-04-19 12:00:00',
    status: '跟进中',
    followTime: '2025-04-19 12:00:00',
    source: '支付宝',
  },
])
function fnSallocation(obj: any) {
  console.log(obj)
}
function fnDetail(obj: any) {
  console.log('详情')
}
</script>

<style scoped></style>
